.TH std::signed_integral 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::signed_integral \- std::signed_integral

.SH Synopsis
   Defined in header <concepts>
   template< class T >                                                 \fI(since C++20)\fP
   concept signed_integral = std::integral<T> && std::is_signed_v<T>;

   The concept signed_integral<T> is satisfied if and only if T is an integral type and
   std::is_signed_v<T> is true.

.SH Notes

   signed_integral<T> may be satisfied by a type that is not a signed integer type, for
   example, char (on a system where char is signed).

.SH Example


// Run this code

 #include <concepts>
 #include <iostream>
 #include <string_view>

 void test(std::signed_integral auto x, std::string_view text = "")
 {
     std::cout << text << " (" + (text == "") << x << ") is a signed integral\\n";
 }

 void test(std::unsigned_integral auto x, std::string_view text = "")
 {
     std::cout << text << " (" + (text == "") << x << ") is an unsigned integral\\n";
 }

 void test(auto x, std::string_view text = "")
 {
     std::cout << text << " (" + (text == "") << x << ") is non-integral\\n";
 }

 int main()
 {
     test(42);               // signed
     test(0xFULL, "0xFULL"); // unsigned
     test('A');              // platform-dependent
     test(true, "true");     // unsigned
     test(4e-2, "4e-2");     // non-integral (hex-float)
     test("∫∫");             // non-integral
 }

.SH Possible output:

 \fB(42)\fP is a signed integral
 0xFULL \fB(15)\fP is an unsigned integral
 (A) is a signed integral
 true \fB(1)\fP is an unsigned integral
 4e-2 (0.04) is non-integral
 (∫∫) is non-integral

.SH See also

   is_integral checks if a type is an integral type
   \fI(C++11)\fP     \fI(class template)\fP
   is_signed   checks if a type is a signed arithmetic type
   \fI(C++11)\fP     \fI(class template)\fP
